<?php
/**
 * Template Name: Home
 **/ 
get_header(); 
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="home-page">
    <?php
    $page_bg = get_field("background_image", get_the_ID());
    $bg_img = '';
    if(!empty($page_bg)) {
        $bg_img = 'style="background: url('.dynamic_url($page_bg['url']).') left center;background-size: 100% 100%; background-repeat: no-repeat;"';
    } 
    ?>
    <div class="container">
        <div class="content-inner" <?php echo $bg_img; ?>>
            <?php //echo get_template_part('inc/slider'); ?>
            
            <div class="video-frame">
                <?php
                $video = get_field("video_embed_code", get_the_ID());
                $video = apply_filters('the_content', $video);
                _e($video); ?>
            </div>
            <div class="middle relative">
                <?php
                $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); 
                ?>
                <img src="<?php echo dynamic_url($thumb[0]); ?>" alt="<?php the_title(); ?>"/>
                <div class="detail">
                    <?php the_content(); ?>
                </div>
            </div>
            
            <div class="bottom relative">
                <?php
                $bottom_content = get_field("bottom_detail", get_the_ID());
                $bottom_content = apply_filters('the_content', $bottom_content);
                $bottom_img = get_field("bottom_image", get_the_ID()); ?>
                <img src="<?php echo dynamic_url($bottom_img['url']); ?>"/>
                <div class="detail">
                    <?php echo $bottom_content; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
endwhile; endif; 
get_footer(); ?>